#!/usr/bin/python
# vim: foldmarker=<([{,}])> foldmethod=marker
import sys, struct, os

# do it <([{
count = os.stat("os_symtab").st_size;
count = count / 8;
infile = open("os_symtab", "rb");
buffera = infile.read();
infile.close();
infile = open("os_symtab_strings", "rb");
bufferb = infile.read();
infile.close();
outfile = open("ossym.list", "w");
i = 0;
strbeg = 0;
while i < count:
	address, offset = struct.unpack("<2i", buffera[i * 8:i * 8 + 8]);
	strend = bufferb.find('\0', strbeg);
	name = bufferb[strbeg:strend];
	strbeg = strend + 1;
	# print name, "=", hex(address);
	outfile.write(name + " = " + hex(address) + ";" + '\n');
	i = i + 1;
outfile.close();
# }])>
